package com.itheima.controller;

import com.itheima.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping("/movie")
public class MovieController {
    @Autowired
    RestTemplate restTemplate;

    @GetMapping("/look")
    public User look() {
        User user = restTemplate.getForObject("http://localhost:8001/user/5", User.class);
        System.out.println("验证用户成功,可以买电影票了!");
        return user;
    }
}
